clear all

use "study6data.dta"

*post
reg postdv treat PID ideo if design==0
est store post

*pre
reg postdv treat predv PID ideo if design==1
est store pre

*quasi
reg postdv treat quasidv1 quasidv2 PID ideo if design==2
est store quasi

*differences in coefficients
suest pre post quasi
test [post_mean]treat=[pre_mean]treat
test [post_mean]treat=[quasi_mean]treat
test [pre_mean]treat=[quasi_mean]treat


*figure 1
gen x=_n
replace x=. if _n>3
gen est=.
gen se=.

reg postdv treat PID ideo if design==0
replace se=_se[treat] in 1
replace est=_b[treat] in 1

reg postdv treat predv PID ideo if design==1
replace se=_se[treat] in 2
replace est=_b[treat] in 2

reg postdv treat quasidv1 quasidv2 PID ideo if design==2
replace se=_se[treat] in 3
replace est=_b[treat] in 3

gen lo=est-se*1.96
gen hi=est+se*1.96

*effect size graph
twoway (scatter est x if x==1, mcol(black)) (scatter est x if x==2, mcol(gray)) (scatter est x if x==3, mcol(sky)) ///
	(rcap lo hi x if x==1, lcol(black)) (rcap lo hi x if x==2, lcol(gray)) (rcap lo hi x if x==3, lcol(sky) ///
	xsc(range(.5 3.5)) xlab(1 "Post-only" 2 "Pre-post" 3 "Quasi", labsize(medsmall)) yline(0) legend(off) ///
	xtitle("") ylab(-.5(.5)1.5, labsize(medsmall)) plotregion(margin(zero)) graphregion(margin(1 1 1 1)) ///
	subtitle("Study 6: GMOs") saving(study6.gph, replace))

graph combine study1.gph study2.gph study3.gph study4.gph study5.gph study6.gph

*amount of attitude change
sum changeany_di changepos_di changesides_di

*relationship between change and perceived change
tab believestable changeany_di, col
tab believestable changepos_di, col
tab believestable changesides_di, col


drop x
gen x=_n
replace x=. if _n>3
gen fx1=.
gen lo1=.
gen hi1=.
gen fx2=.
gen lo2=.
gen hi2=.

prtest believestable, by(changeany_di)
replace fx1=r(P2) in 1
replace lo1=r(lb2) in 1
replace hi1=r(ub2) in 1
replace fx2=r(P1) in 1
replace lo2=r(lb1) in 1
replace hi2=r(ub1) in 1

prtest believestable, by(changepos_di)
replace fx1=r(P2) in 2
replace lo1=r(lb2) in 2
replace hi1=r(ub2) in 2
replace fx2=r(P1) in 2
replace lo2=r(lb1) in 2
replace hi2=r(ub1) in 2

prtest believestable, by(changesides_di)
replace fx1=r(P2) in 3
replace lo1=r(lb2) in 3
replace hi1=r(ub2) in 3
replace fx2=r(P1) in 3
replace lo2=r(lb1) in 3
replace hi2=r(ub1) in 3

graph twoway (bar fx1 x, barwidth(.5) color(gs12) ylab(0(.25)1) ytitle("Proportion Perceiving Stability")) ///
	(rcap lo1 hi1 x, lcol(black) legend(off) xlab(1 "7-pt" 2 "3-pt" 3 "2-pt") xsc(range(.5 3.5) titlegap(2)) xtitle("Measure of Attitude Change") ///
	subtitle("Respondents with Unstable Attitudes") saving(unstable.gph, replace))

graph twoway (bar fx2 x, barwidth(.5) color(gs12) ylab(0(.25)1) ytitle("Proportion Perceiving Stability")) ///
	(rcap lo2 hi2 x, lcol(black) legend(off) xlab(1 "7-pt" 2 "3-pt" 3 "2-pt") xsc(range(.5 3.5) titlegap(2)) xtitle("Measure of Attitude Change") ///
	subtitle("Respondents with Stable Attitudes") saving(stable.gph, replace))

graph combine stable.gph unstable.gph

